package com.appheader.rongmaphone.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.appheader.rongmaphone.R;
import com.appheader.rongmaphone.activity.ContentActivity;
import com.appheader.rongmaphone.views.MyWebView;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyWebFragment extends BaseHolderFragment {
    int keyx=0;
    int keyy=0;
    public static MyWebFragment newInstance(int positionx,int positiony ) {
        MyWebFragment fragment = new MyWebFragment();
        Bundle args = new Bundle();
        args.putInt("positionx", positionx);
        args.putInt("positiony", positiony);
        fragment.setArguments(args);
        return fragment;
    }
    private MyWebView myWebView;

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        myWebView = (MyWebView) view.findViewById(R.id.web);

        Bundle arguments = getArguments();
        keyx = arguments.getInt("positionx");
        keyy = arguments.getInt("positiony");
        Log.e("xy", "onViewCreated: "+keyx+"---"+ keyy);
    }

    public MyWebFragment() {
        // Required empty public constructor
    }

//    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                             Bundle savedInstanceState) {
//        // Inflate the layout for this fragment
//        return inflater.inflate(R.layout.fragment_web2, container, false);
//    }

    @Override
    protected View initViews(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_web2, container, false);
    }

    @Override
    protected void initFirstVisibleData() {
        Log.e("MyWebFramgent", "initFirstVisibleData: "+ContentActivity.listMap.get(keyx).get(keyy));
        myWebView.loadUrl(ContentActivity.listMap.get(keyx).get(keyy));
    }

}
